package com.bdqn.mapper;

import com.bdqn.pojo.HisScheduling;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

//排班表
public interface HisSchedulingMapper {
//    根据医生id和科室id查询排班信息
    List<HisScheduling> getHisScheduling(@Param("userId") int userId,@Param("deptId")  int deptId);
//查询本周的排班日期
@Select("SELECT his_scheduling.user_id, " +
        "dept_id,"+
        "       DATE_FORMAT(his_scheduling.scheduling_day, '%Y-%m-%d') AS scheduling_day, " +
        "       his_scheduling.subsection_type, " +
        "       his_scheduling.scheduling_type, " +
        "       subsection_type.dict_label AS subsectionName " +
        "FROM his_scheduling " +
        "LEFT JOIN sys_dict_data subsection_type " +
        "ON his_scheduling.subsection_type = subsection_type.dict_value " +
        "AND subsection_type.dict_type = 'his_subsection_type' " +
        "WHERE his_scheduling.user_id = #{userId} " +
        "AND his_scheduling.subsection_type = #{subsectionType} " +
        "AND DATE_FORMAT(his_scheduling.scheduling_day, '%Y-%m-%d') BETWEEN #{startDate} AND #{endDate}")
List<HisScheduling> getScheduleWeekDate(@Param("userId") int userId,
                                             @Param("subsectionType") String subsectionType,
                                             @Param("startDate") String startDate,
                                             @Param("endDate") String endDate);
List<HisScheduling> getHisSchedulingPB(@Param("deptId") int deptId,@Param("subsectionType") int subsectionType,@Param("schedulingType") int schedulingType,@Param("schedulingDay") String schedulingDay);
}
